package org.wzry.lmx;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import org.wzry.entity.Dangeading;
import org.wzry.entity.Handbook;
import org.wzry.entity.Island;
import org.wzry.entity.Motif;
import org.wzry.util.Lmxinfo;

import com.mysql.fabric.xmlrpc.base.Array;

public class Lmx {
		//C:\Users\Administrator\Desktop\web\tomcat\webapps\lmx\lmx\
		final String path = "C:\\Users\\Administrator\\Desktop\\web\\tomcat\\webapps\\lmx\\lmx\\";
				//"C:\Users\17299\Desktop\厘米秀家族\";
	/**
	 * 王者-武器
	 * @return
	 * @throws IOException
	 */
		public List<Handbook> handbook(){
			List<Handbook> ls = new ArrayList<Handbook>();
			String texts = Lmxinfo.info(path + "卡片图鉴-分割.txt");
			for(String s : texts.split("#")) {
				String[] ss = s.split("@");
				Handbook handbook = new Handbook(ss[0].substring(3), ss[1].substring(3), ss[2].substring(3), ss[3].substring(3), ss[4].substring(3));
				ls.add(handbook);
				}
			return ls;
		}
		
		/**
		 * 厘米-岛屿
		 * @return
		 */
		public List<Island> island(){
			List<Island> ls = new ArrayList<Island>(); 
			String texts = Lmxinfo.info(path + "厘米岛屿-分割.txt");
			for(String s : texts.split("#")) {
				String[] ss = s.split("@");
				if(ss.length >= 8) {
					Island island = new Island(ss[0].substring(3), ss[1].substring(5), ss[2].substring(5), ss[3].substring(3), ss[4], ss[5], ss[6], ss[7]);
					ls.add(island);
				}
				
			}
			return ls;
			
		}
		
		/**
		 * 厘米-段位
		 * @return
		 */
		public List<Dangeading> dangeading(){
			List<Dangeading> ls = new ArrayList<Dangeading>();
			String texts = Lmxinfo.info(path  + "段位奖励-分割.txt");
			for(String s : texts.split("#")) {				
				String[] ss = s.split("@");
				Dangeading dangeading = new Dangeading(ss[0].substring(3), ss[1].substring(3), ss[2].substring(3), ss[3].substring(3));
				ls.add(dangeading);
			}
			return ls;
		}
		
		/**
		 * 主题
		 * @return
		 */
		public List<Motif> motif(){
			List<Motif> ls = new ArrayList<Motif>(); 
			
			String texts = Lmxinfo.info(path + "主题炫卡-分割.txt");
			for(String s : texts.split("#")) {
				String[] ss = s.split("@");
				Motif motif = new Motif(ss[0].substring(3), ss[1].substring(3), ss[2].substring(3));
				ls.add(motif);
				
			}
			return ls;
			
		}
	
}
